<!DOCTYPE html>
<html>

<head>
    <title>评论我</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
    <link rel="stylesheet" href="/css/reset.css" />
    <link rel="stylesheet" href="/css/myProfiles.css" />
    <link rel="stylesheet" href="/css/strategyComment.css" />
    <link rel="stylesheet" href="/css/message.css" />
    <link href="https://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="/css/zyd.comment.css" rel="stylesheet" type="text/css">
    <link href="/css/wangEditor-fullscreen-plugin.css" rel="stylesheet" type="text/css">
    <script src="/js/plugins/jrender/jrender.js"></script>
    <link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog/dialog.css"/>
    <script src="/js/plugins/dialog/dialog.min.js"></script>
    <script src="/js/common.js"></script>

    <script type="text/javascript">
        $(function () {
            //当前用户id
            var id=getUser().id;
            var msgs;
            var currentPage = 1;
            var pages;
            //获取评论内容信息
            $.get("/users/"+id+"/commentMes",function (data) {
                if(data){
                    msgs = data.list;
                    pages = data.pages;
                    renderVal(data);
                }
            });


            $(window).scroll(function () {
                if (isFull()) {
                    if (currentPage < pages) {
                        $.get("/users/"+id+"/commentMes", {currentPage: ++currentPage}, function (data) {
                            if(data){
                                $.merge(msgs, data.list);
                                renderVal({list:msgs});
                            }
                        })
                    } else {
                        $(document).dialog({
                            type: "notice",
                            infoText: "到底部了",
                            autoClose: 2500,
                            position: "bottom"  // center: 居中; bottom: 底部
                        });
                    }
                }

            })

            function renderVal(data) {
                $(".commentList").renderValues(data,{
                    handle:function (ele, val) {
                        ele.href="/travelCatalogs.html?id="+val;
                    }
                });
            }

            $.ajax({
                type: "POST",
                url:"/users/"+id+"/commentMes",
                data:{"_method":"put"}
            })

        });
    </script>

</head>

<body>

<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left" ></i></span>
            </a>
        </div>
        <div class="col">
            <span>评论我</span>
        </div>
        <div class="col"></div>
    </div>
    <p>
</div>

<div class="commentList">
    <ul class="comment" render-loop="list">
        <li>
            <div class="comment-body">
                <div class="cheader">
                    <a target="_blank">
                        <img class="userImage" render-src="list.user.headImgUrl">
                        <strong render-html="list.user.nickName">李四</strong>
                    </a>
                    <div class="timer" render-html="list.createTime">
                        <i class="fa fa-clock-o fa-fw"></i>
                    </div>
                </div>
                <div class="content" >评论你的游记:<span render-html="list.comment"></span></div>
                <div class="sign" style=" float:right;">
                    <a href="#" render-key="list.travel.id" render-fun="handle" style="color: blue">查看详情>></a>
                </div>
            </div>
        </li>

    </ul>

</div>

</body>

</html>